package com.lambda.demo.models;

import java.util.List;
import java.util.Objects;

public class Author {
  //id
  private Long id;
  //name
  private String name;
  //age
  private int age;
  //intro
  private String intro;
  //作品
  private List<Book> books;

  public Author(Long id, String name, int age, String intro, List<Book> books) {
    this.id = id;
    this.name = name;
    this.age = age;
    this.intro = intro;
    this.books = books;
  }

  public Long getId() {
    return id;
  }

  public void setId(Long id) {
    this.id = id;
  }

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public int getAge() {
    return age;
  }

  public void setAge(int age) {
    this.age = age;
  }

  public String getIntro() {
    return intro;
  }

  public void setIntro(String intro) {
    this.intro = intro;
  }

  public List<Book> getBooks() {
    return books;
  }

  public void setBooks(List<Book> books) {
    this.books = books;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;
    Author author = (Author) o;
    return age == author.age && Objects.equals(id, author.id) && Objects.equals(name, author.name) && Objects.equals(intro, author.intro) && Objects.equals(books, author.books);
  }

  @Override
  public int hashCode() {
    return Objects.hash(id, name, age, intro, books);
  }
}
